#ifndef __CLOCK_TIME_H__
#define __CLOCK_TIME_H__
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "Wed_errno.h"
#include "Wed_common.h"
#include "kernel/Wed_clock.h"
#include "sys/time.h"

#define clockid_t                Wed_clockid_t

#define MILLISECOND_PER_SECOND   1000UL
#define MICROSECOND_PER_SECOND   1000000UL
#define NANOSECOND_PER_SECOND    1000000000UL

#define MICROSECOND_PER_TICK    (MICROSECOND_PER_SECOND / WED_TICK_PER_SECOND)

/* \brief 获取当前的实际时间 */
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME      1
#endif

/* \brief 获取一个单调递增的时钟计时 */
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC     4
#endif

typedef int Wed_clockid_t;

/**
 * \brief 获取时间
 *
 * @param clockid 获取的时间类型
 * @param p_tp    存储时间的时间戳结构体
 *
 * @return 成功返回 0
 */
int clock_gettime(clockid_t clockid, struct timespec *p_tp);
#endif
